package com.ctshk.sapp.order.airexpress.controller;

import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.rpc.order.airexpress.req.AirportExpressOrderRejectPaymentReq;
import com.ctshk.rpc.order.airexpress.service.IAirportExpressOrderCollectionService;
import com.ctshk.rpc.order.airexpress.service.IAirportExpressOrderRefundService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;

import com.ctshk.common.web.support.BaseController;

import javax.validation.Valid;

/**
 * <p>
 * 机场快线收款明细 前端控制器
 * </p>
 *
 * @author 叶冠峰
 * @since 2021-02-23
 */
@RestController
@RequestMapping("/airport/express/order/collection")
@Api(value = "机场快线订单收款", tags = "机场快线订单收款")
public class AirportExpressOrderCollectionController extends BaseController {
    @DubboReference
    IAirportExpressOrderCollectionService airportExpressOrderCollectionService;

    @ApiOperation(value = "机场快线-订单操作-再次确认收款", notes = "机场快线-订单操作-再次确认收款")
    @OperationLogAnnotation(operModul = OperationLogModel.ORDER, operType = OperationLogType.UPDATE, operTitle = "机场快线-订单中心-再次确认收款", operDesc = "机场快线-订单中心-再次确认收款")
    @PostMapping("/reconfirm/{id}")
    public Result reconfirm(@PathVariable("id") Long id) {
        Long userId = getCurrentUser(getRequest()).getId();
        int num = airportExpressOrderCollectionService.reconfirm(id, userId);
        return Result.success(num);
    }

    @ApiOperation(value = "机场快线-订单操作-收款财务驳回", notes = "机场快线-订单操作-收款财务驳回")
    @OperationLogAnnotation(operModul = OperationLogModel.ORDER, operType = OperationLogType.UPDATE, operTitle = "机场快线-订单中心-收款财务驳回", operDesc = "机场快线-订单中心-收款财务驳回")
    @PostMapping("/reject")
    public Result rejectPayment(@RequestBody @Valid AirportExpressOrderRejectPaymentReq rejectPayment) {
        Long userId = getCurrentUser(getRequest()).getId();
//        int num = airportExpressOrderCollectionService.rejectPayment(rejectPayment.getOrderNumber, userId, rejectPayment.getMsg);
        return Result.success();
    }
}
